Refactor and implement feedback on v2#1973
Merged
Conversation
…chical structure and metadata
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements several V2 code-quality improvements requested in #1931, focusing on safer HTTP handling, stricter parsing, and reduced mutation side effects.
Changes:
- Skip JSON parsing for HTTP 204 responses in
_get/_postand add tests for the behavior. - Refactor payload preparation to camelize keys and apply abbreviations in a single pass.
- Harden model parsing (device URL fullmatch + compiled regex; JSON event state casting with decode-error tolerance) and prevent action-queue merges from mutating caller-owned
Action.commands.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
pyoverkiz/client.py |
Return None on 204 responses and clarify get_places() documentation. |
pyoverkiz/serializers.py |
Single-pass payload key transformation (camelize + abbreviation fix). |
pyoverkiz/models.py |
Compiled/strict device URL parsing; tolerant JSON casting for EventState; expanded Place docstring. |
pyoverkiz/action_queue.py |
Avoid mutating caller Action instances during merge; improve merge performance with dict indexing. |
tests/test_client.py |
Adds coverage ensuring 204 responses don’t call response.json(). |
tests/test_models.py |
Adds coverage for strict device URL parsing and EventState JSON decode behavior (including logging). |
tests/test_action_queue.py |
Adds coverage ensuring action-queue merging doesn’t mutate input Action.commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ors and update tests accordingly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement feedback from #1931